﻿using System;
using System.Collections.Generic;

namespace Dapper.Sharding
{
    public abstract class ITableManager
    {
        public ITableManager(string name, IDatabase database)
        {
            Name = name;
            DataBase = database;
        }


        #region prototype

        public string Name { get; }

        public IDatabase DataBase { get; }

        public DataBaseType DbType
        {
            get
            {
                return DataBase.DbType;
            }
        }

        public DataBaseVersion DbVersion
        {
            get
            {
                return DataBase.DbVersion;
            }
        }

        #endregion

        public abstract void CreateIndex(string name, string columns, IndexType indexType);

        public abstract void DropIndex(string name);

        public abstract void AddColumn(string name, Type t, double length = 0, string comment = null, string columnType = null, int scale = 0);

        public abstract void AddColumn(string name, string columnType, string comment = null);

        public abstract void DropColumn(string name);

        public abstract void ModifyColumn(string name, Type t, double length = 0, string comment = null, string columnType = null, int scale = 0);

        public abstract void ModifyColumn(string name, string columnType, string comment = null);

        public abstract void CommentColumn(string name, string comment);

        public abstract void ReNameColumn(string name, string newName, Type t = null, double length = 0, string comment = null, string columnType = null, int scale = 0);

        public abstract List<IndexEntity> GetIndexEntityList();

        public abstract List<ColumnEntity> GetColumnEntityList(TableEntity tb = null, bool firstCharToUpper = false);

    }
}
